{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "402bf263",
   "metadata": {},
   "source": [
    "* 日期：2023-03-29/week06（周三）  \n",
    "* 课程：Python-data-analysis-couse  \n",
    "* 记录人：黄斐珍  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "76f6b0df",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "70525de8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Gender</th>\n",
       "      <th>Height</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>小黄</td>\n",
       "      <td>163</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>小曾</td>\n",
       "      <td>160</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>小阳</td>\n",
       "      <td>175</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>小张</td>\n",
       "      <td>180</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  Gender  Height\n",
       "0     小黄     163\n",
       "1     小曾     160\n",
       "2     小阳     175\n",
       "3     小张     180"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 创建长表格\n",
    "pd.DataFrame({'Gender':['小黄','小曾','小阳','小张'],\n",
    "              'Height':[163, 160, 175, 180]})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "fa6afdba",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Height: 小黄</th>\n",
       "      <th>Height: 小曾</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>163</td>\n",
       "      <td>175</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>160</td>\n",
       "      <td>180</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Height: 小黄  Height: 小曾\n",
       "0         163         175\n",
       "1         160         180"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 创建宽表格\n",
    "pd.DataFrame({'Height: 小黄':[163, 160],\n",
    "              'Height: 小曾':[175, 180]})"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d45dfd2e",
   "metadata": {},
   "source": [
    "# 1.pivot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "1e7af3e7",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 课本练习\n",
    "df = pd.DataFrame({'Class':[1,1,2,2],\n",
    "                   'Name':['小黄','小黄','小张','小张'],\n",
    "                   'Subject':['Chinese','Math','Chinese','Math'],\n",
    "                   'Grade':[80,75,90,85]})\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "f7666dd8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Class</th>\n",
       "      <th>Name</th>\n",
       "      <th>Subject</th>\n",
       "      <th>Grade</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>小黄</td>\n",
       "      <td>Chinese</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>小黄</td>\n",
       "      <td>Math</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>小张</td>\n",
       "      <td>Chinese</td>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2</td>\n",
       "      <td>小张</td>\n",
       "      <td>Math</td>\n",
       "      <td>85</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Class Name  Subject  Grade\n",
       "0      1   小黄  Chinese     80\n",
       "1      1   小黄     Math     75\n",
       "2      2   小张  Chinese     90\n",
       "3      2   小张     Math     85"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "49d942a3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>Subject</th>\n",
       "      <th>Chinese</th>\n",
       "      <th>Math</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Name</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>小张</th>\n",
       "      <td>90</td>\n",
       "      <td>85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>小黄</th>\n",
       "      <td>80</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "Subject  Chinese  Math\n",
       "Name                  \n",
       "小张            90    85\n",
       "小黄            80    75"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 1.每个人（index）的学科（coluns）成绩分布情况  \n",
    "df.pivot(index='Name', columns='Subject', values='Grade')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "7c3bb0b4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>Name</th>\n",
       "      <th>小张</th>\n",
       "      <th>小黄</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Subject</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Chinese</th>\n",
       "      <td>90</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Math</th>\n",
       "      <td>85</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "Name     小张  小黄\n",
       "Subject        \n",
       "Chinese  90  80\n",
       "Math     85  75"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 2.每个学科(index)每个人（columns）的情况\n",
    "df.pivot(index='Subject',columns='Name',values='Grade')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "afe74855",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "0462f5b7",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\86130\\AppData\\Local\\Temp\\ipykernel_21732\\2229610766.py:5: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df_hurun['价值（亿元人民币）'] = df_hurun['价值（亿元人民币）'].astype('int64')\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>排名</th>\n",
       "      <th>排名变化</th>\n",
       "      <th>企业名称</th>\n",
       "      <th>价值（亿元人民币）</th>\n",
       "      <th>价值变化（亿元人民币）</th>\n",
       "      <th>国家</th>\n",
       "      <th>城市</th>\n",
       "      <th>行业</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>抖音</td>\n",
       "      <td>13400</td>\n",
       "      <td>-10050</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>社交媒体</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>SpaceX</td>\n",
       "      <td>8400</td>\n",
       "      <td>1680</td>\n",
       "      <td>美国</td>\n",
       "      <td>洛杉矶</td>\n",
       "      <td>航天</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>-1</td>\n",
       "      <td>蚂蚁集团</td>\n",
       "      <td>8000</td>\n",
       "      <td>-2010</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>Stripe</td>\n",
       "      <td>4100</td>\n",
       "      <td>-2210</td>\n",
       "      <td>美国</td>\n",
       "      <td>旧金山</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>5</td>\n",
       "      <td>11</td>\n",
       "      <td>Shein</td>\n",
       "      <td>4000</td>\n",
       "      <td>2680</td>\n",
       "      <td>中国</td>\n",
       "      <td>广州</td>\n",
       "      <td>电子商务</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>Impossible 食品</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>美国</td>\n",
       "      <td>雷德伍德城</td>\n",
       "      <td>食品饮料</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>微医</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>健康科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>99</td>\n",
       "      <td>58</td>\n",
       "      <td>蜂巢能源</td>\n",
       "      <td>460</td>\n",
       "      <td>190</td>\n",
       "      <td>中国</td>\n",
       "      <td>常州</td>\n",
       "      <td>新能源</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100</th>\n",
       "      <td>99</td>\n",
       "      <td>-6</td>\n",
       "      <td>Better.com</td>\n",
       "      <td>460</td>\n",
       "      <td>60</td>\n",
       "      <td>美国</td>\n",
       "      <td>纽约</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>101</th>\n",
       "      <td>99</td>\n",
       "      <td>-20</td>\n",
       "      <td>Automation Anywhere</td>\n",
       "      <td>460</td>\n",
       "      <td>-10</td>\n",
       "      <td>美国</td>\n",
       "      <td>圣何塞</td>\n",
       "      <td>人工智能</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>101 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     排名 排名变化                 企业名称  价值（亿元人民币） 价值变化（亿元人民币）  国家     城市    行业\n",
       "1     1    0                   抖音      13400      -10050  中国     北京  社交媒体\n",
       "2     2    1               SpaceX       8400        1680  美国    洛杉矶    航天\n",
       "3     3   -1                 蚂蚁集团       8000       -2010  中国     杭州  金融科技\n",
       "4     4    0               Stripe       4100       -2210  美国    旧金山  金融科技\n",
       "5     5   11                Shein       4000        2680  中国     广州  电子商务\n",
       "..   ..  ...                  ...        ...         ...  ..    ...   ...\n",
       "97   95  -16        Impossible 食品        470           0  美国  雷德伍德城  食品饮料\n",
       "98   95  -16                   微医        470           0  中国     杭州  健康科技\n",
       "99   99   58                 蜂巢能源        460         190  中国     常州   新能源\n",
       "100  99   -6           Better.com        460          60  美国     纽约  金融科技\n",
       "101  99  -20  Automation Anywhere        460         -10  美国    圣何塞  人工智能\n",
       "\n",
       "[101 rows x 8 columns]"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hurun_独角兽= pd.read_html('https://hurun.net/zh-CN/Info/Detail?num=L9SQPH9FKJB1')[-3]\n",
    "hurun_独角兽[0:1].values.tolist()[0]\n",
    "df_hurun=hurun_独角兽[1:]\n",
    "df_hurun.columns = hurun_独角兽[0:1].values.tolist()[0]\n",
    "df_hurun['价值（亿元人民币）'] = df_hurun['价值（亿元人民币）'].astype('int64')\n",
    "df_hurun"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "ed04ae18",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_hurun.to_excel('output.xlsx')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4de751ef",
   "metadata": {},
   "source": [
    "* 每个国家（index）的行业（columns）的估值（values）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "36de898c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>排名</th>\n",
       "      <th>排名变化</th>\n",
       "      <th>企业名称</th>\n",
       "      <th>价值（亿元人民币）</th>\n",
       "      <th>价值变化（亿元人民币）</th>\n",
       "      <th>国家</th>\n",
       "      <th>城市</th>\n",
       "      <th>行业</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>抖音</td>\n",
       "      <td>13400</td>\n",
       "      <td>-10050</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>社交媒体</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>-1</td>\n",
       "      <td>蚂蚁集团</td>\n",
       "      <td>8000</td>\n",
       "      <td>-2010</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>5</td>\n",
       "      <td>11</td>\n",
       "      <td>Shein</td>\n",
       "      <td>4000</td>\n",
       "      <td>2680</td>\n",
       "      <td>中国</td>\n",
       "      <td>广州</td>\n",
       "      <td>电子商务</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>8</td>\n",
       "      <td>3</td>\n",
       "      <td>微众银行</td>\n",
       "      <td>2200</td>\n",
       "      <td>200</td>\n",
       "      <td>中国</td>\n",
       "      <td>深圳</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>9</td>\n",
       "      <td>2</td>\n",
       "      <td>京东科技</td>\n",
       "      <td>2000</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>数字科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>11</td>\n",
       "      <td>-2</td>\n",
       "      <td>菜鸟网络</td>\n",
       "      <td>1800</td>\n",
       "      <td>-470</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>物流</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>16</td>\n",
       "      <td>0</td>\n",
       "      <td>小红书</td>\n",
       "      <td>1300</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>上海</td>\n",
       "      <td>软件服务</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>22</td>\n",
       "      <td>-2</td>\n",
       "      <td>大疆</td>\n",
       "      <td>1200</td>\n",
       "      <td>130</td>\n",
       "      <td>中国</td>\n",
       "      <td>深圳</td>\n",
       "      <td>机器人</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>25</td>\n",
       "      <td>85</td>\n",
       "      <td>联影医疗</td>\n",
       "      <td>1040</td>\n",
       "      <td>700</td>\n",
       "      <td>中国</td>\n",
       "      <td>上海</td>\n",
       "      <td>健康科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>26</td>\n",
       "      <td>-5</td>\n",
       "      <td>元气森林</td>\n",
       "      <td>1000</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>食品饮料</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>30</td>\n",
       "      <td>New</td>\n",
       "      <td>滴滴</td>\n",
       "      <td>965</td>\n",
       "      <td>New</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>共享经济</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>32</td>\n",
       "      <td>5</td>\n",
       "      <td>货拉拉</td>\n",
       "      <td>870</td>\n",
       "      <td>200</td>\n",
       "      <td>中国</td>\n",
       "      <td>香港</td>\n",
       "      <td>物流</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>42</td>\n",
       "      <td>-8</td>\n",
       "      <td>阳光保险</td>\n",
       "      <td>740</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>保险</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51</th>\n",
       "      <td>50</td>\n",
       "      <td>271</td>\n",
       "      <td>得物</td>\n",
       "      <td>670</td>\n",
       "      <td>510</td>\n",
       "      <td>中国</td>\n",
       "      <td>上海</td>\n",
       "      <td>电子商务</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52</th>\n",
       "      <td>50</td>\n",
       "      <td>29</td>\n",
       "      <td>兴盛优选</td>\n",
       "      <td>670</td>\n",
       "      <td>200</td>\n",
       "      <td>中国</td>\n",
       "      <td>长沙</td>\n",
       "      <td>新零售</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>53</th>\n",
       "      <td>50</td>\n",
       "      <td>-13</td>\n",
       "      <td>车好多</td>\n",
       "      <td>670</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>电子商务</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54</th>\n",
       "      <td>50</td>\n",
       "      <td>-13</td>\n",
       "      <td>远景能源</td>\n",
       "      <td>670</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>无锡</td>\n",
       "      <td>新能源</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>57</th>\n",
       "      <td>57</td>\n",
       "      <td>53</td>\n",
       "      <td>中创新航</td>\n",
       "      <td>640</td>\n",
       "      <td>300</td>\n",
       "      <td>中国</td>\n",
       "      <td>常州</td>\n",
       "      <td>新能源</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60</th>\n",
       "      <td>58</td>\n",
       "      <td>-3</td>\n",
       "      <td>极氪汽车</td>\n",
       "      <td>600</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>宁波</td>\n",
       "      <td>新能源汽车</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>67</th>\n",
       "      <td>65</td>\n",
       "      <td>35</td>\n",
       "      <td>小马智行</td>\n",
       "      <td>570</td>\n",
       "      <td>200</td>\n",
       "      <td>中国</td>\n",
       "      <td>广州</td>\n",
       "      <td>人工智能</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>68</th>\n",
       "      <td>65</td>\n",
       "      <td>-5</td>\n",
       "      <td>58同城</td>\n",
       "      <td>570</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>软件服务</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>81</th>\n",
       "      <td>75</td>\n",
       "      <td>-10</td>\n",
       "      <td>平安智慧城市</td>\n",
       "      <td>535</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>深圳</td>\n",
       "      <td>大数据</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>83</th>\n",
       "      <td>83</td>\n",
       "      <td>27</td>\n",
       "      <td>京东产发</td>\n",
       "      <td>515</td>\n",
       "      <td>180</td>\n",
       "      <td>中国</td>\n",
       "      <td>宿迁</td>\n",
       "      <td>企业服务</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>85</th>\n",
       "      <td>84</td>\n",
       "      <td>-47</td>\n",
       "      <td>滴滴货运</td>\n",
       "      <td>500</td>\n",
       "      <td>-170</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>物流</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>微医</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>健康科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>99</td>\n",
       "      <td>58</td>\n",
       "      <td>蜂巢能源</td>\n",
       "      <td>460</td>\n",
       "      <td>190</td>\n",
       "      <td>中国</td>\n",
       "      <td>常州</td>\n",
       "      <td>新能源</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    排名 排名变化    企业名称  价值（亿元人民币） 价值变化（亿元人民币）  国家  城市     行业\n",
       "1    1    0      抖音      13400      -10050  中国  北京   社交媒体\n",
       "3    3   -1    蚂蚁集团       8000       -2010  中国  杭州   金融科技\n",
       "5    5   11   Shein       4000        2680  中国  广州   电子商务\n",
       "8    8    3    微众银行       2200         200  中国  深圳   金融科技\n",
       "9    9    2    京东科技       2000           0  中国  北京   数字科技\n",
       "11  11   -2    菜鸟网络       1800        -470  中国  杭州     物流\n",
       "18  16    0     小红书       1300           0  中国  上海   软件服务\n",
       "22  22   -2      大疆       1200         130  中国  深圳    机器人\n",
       "25  25   85    联影医疗       1040         700  中国  上海   健康科技\n",
       "28  26   -5    元气森林       1000           0  中国  北京   食品饮料\n",
       "30  30  New      滴滴        965         New  中国  北京   共享经济\n",
       "32  32    5     货拉拉        870         200  中国  香港     物流\n",
       "44  42   -8    阳光保险        740           0  中国  北京     保险\n",
       "51  50  271      得物        670         510  中国  上海   电子商务\n",
       "52  50   29    兴盛优选        670         200  中国  长沙    新零售\n",
       "53  50  -13     车好多        670           0  中国  北京   电子商务\n",
       "54  50  -13    远景能源        670           0  中国  无锡    新能源\n",
       "57  57   53    中创新航        640         300  中国  常州    新能源\n",
       "60  58   -3    极氪汽车        600           0  中国  宁波  新能源汽车\n",
       "67  65   35    小马智行        570         200  中国  广州   人工智能\n",
       "68  65   -5    58同城        570           0  中国  北京   软件服务\n",
       "81  75  -10  平安智慧城市        535           0  中国  深圳    大数据\n",
       "83  83   27    京东产发        515         180  中国  宿迁   企业服务\n",
       "85  84  -47    滴滴货运        500        -170  中国  北京     物流\n",
       "98  95  -16      微医        470           0  中国  杭州   健康科技\n",
       "99  99   58    蜂巢能源        460         190  中国  常州    新能源"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun.query('国家 == \"中国\"')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "763f69bd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['社交媒体', '金融科技', '电子商务', '数字科技', '物流', '软件服务', '机器人', '健康科技',\n",
       "       '食品饮料', '共享经济', '保险', '新零售', '新能源', '新能源汽车', '人工智能', '大数据', '企业服务'],\n",
       "      dtype=object)"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun.query('国家==\"中国\"')['行业'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "234c371b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['航天', '金融科技', '大数据', '快递', '物流', '企业服务', '共享经济', '社交媒体', '人工智能',\n",
       "       '健康科技', '电子商务', '生物科技', '区块链', '软件服务', '游戏', '网络安全', '分析', '机器人',\n",
       "       '食品饮料'], dtype=object)"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun.query('国家==\"美国\"')['行业'].unique()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "18e19b7d",
   "metadata": {},
   "source": [
    "# pivot_table 增加聚合方法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "81d38dac",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>行业</th>\n",
       "      <th>人工智能</th>\n",
       "      <th>企业服务</th>\n",
       "      <th>保险</th>\n",
       "      <th>健康科技</th>\n",
       "      <th>共享经济</th>\n",
       "      <th>分析</th>\n",
       "      <th>区块链</th>\n",
       "      <th>大数据</th>\n",
       "      <th>快递</th>\n",
       "      <th>教育科技</th>\n",
       "      <th>...</th>\n",
       "      <th>游戏</th>\n",
       "      <th>物流</th>\n",
       "      <th>生物科技</th>\n",
       "      <th>电子商务</th>\n",
       "      <th>社交媒体</th>\n",
       "      <th>网络安全</th>\n",
       "      <th>航天</th>\n",
       "      <th>软件服务</th>\n",
       "      <th>金融科技</th>\n",
       "      <th>食品饮料</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <td>570.0</td>\n",
       "      <td>515.0</td>\n",
       "      <td>740.0</td>\n",
       "      <td>1040.0</td>\n",
       "      <td>965.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>535.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1800.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>4000.0</td>\n",
       "      <td>13400.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1300.0</td>\n",
       "      <td>8000.0</td>\n",
       "      <td>1000.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>535.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>480.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>720.0</td>\n",
       "      <td>1500.0</td>\n",
       "      <td>...</td>\n",
       "      <td>535.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度尼西亚</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>700.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1300.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>土耳其</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>800.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>墨西哥</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>580.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>巴哈马</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1300.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>德国</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>555.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>澳大利亚</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1750.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞典</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞士</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>575.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <td>870.0</td>\n",
       "      <td>1170.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>840.0</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>575.0</td>\n",
       "      <td>760.0</td>\n",
       "      <td>2500.0</td>\n",
       "      <td>1320.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>600.0</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>800.0</td>\n",
       "      <td>840.0</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>600.0</td>\n",
       "      <td>8400.0</td>\n",
       "      <td>750.0</td>\n",
       "      <td>4100.0</td>\n",
       "      <td>470.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>英国</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>700.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>570.0</td>\n",
       "      <td>1900.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>越南</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>韩国</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>535.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>560.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>马耳他</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3000.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>16 rows × 26 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "行业      人工智能    企业服务     保险    健康科技    共享经济     分析     区块链     大数据      快递  \\\n",
       "国家                                                                           \n",
       "中国     570.0   515.0  740.0  1040.0   965.0    NaN     NaN   535.0     NaN   \n",
       "以色列      NaN     NaN    NaN     NaN     NaN    NaN   535.0     NaN     NaN   \n",
       "印度       NaN     NaN    NaN     NaN   480.0    NaN     NaN     NaN   720.0   \n",
       "印度尼西亚    NaN     NaN    NaN     NaN   700.0    NaN     NaN     NaN     NaN   \n",
       "土耳其      NaN     NaN    NaN     NaN     NaN    NaN     NaN     NaN   800.0   \n",
       "墨西哥      NaN     NaN    NaN     NaN     NaN    NaN     NaN     NaN     NaN   \n",
       "巴哈马      NaN     NaN    NaN     NaN     NaN    NaN  1300.0     NaN     NaN   \n",
       "德国       NaN     NaN    NaN     NaN     NaN    NaN     NaN     NaN     NaN   \n",
       "澳大利亚     NaN     NaN    NaN     NaN     NaN    NaN     NaN     NaN     NaN   \n",
       "瑞典       NaN     NaN    NaN     NaN     NaN    NaN     NaN     NaN     NaN   \n",
       "瑞士       NaN     NaN    NaN     NaN     NaN    NaN   575.0     NaN     NaN   \n",
       "美国     870.0  1170.0    NaN   840.0  1000.0  575.0   760.0  2500.0  1320.0   \n",
       "英国       NaN     NaN    NaN     NaN     NaN    NaN   700.0     NaN     NaN   \n",
       "越南       NaN     NaN    NaN     NaN     NaN    NaN     NaN     NaN     NaN   \n",
       "韩国       NaN     NaN    NaN     NaN     NaN    NaN   535.0     NaN     NaN   \n",
       "马耳他      NaN     NaN    NaN     NaN     NaN    NaN  3000.0     NaN     NaN   \n",
       "\n",
       "行业       教育科技  ...     游戏      物流   生物科技    电子商务     社交媒体   网络安全      航天  \\\n",
       "国家             ...                                                         \n",
       "中国        NaN  ...    NaN  1800.0    NaN  4000.0  13400.0    NaN     NaN   \n",
       "以色列       NaN  ...    NaN     NaN    NaN     NaN      NaN    NaN     NaN   \n",
       "印度     1500.0  ...  535.0     NaN    NaN     NaN      NaN    NaN     NaN   \n",
       "印度尼西亚     NaN  ...    NaN     NaN    NaN  1300.0      NaN    NaN     NaN   \n",
       "土耳其       NaN  ...    NaN     NaN    NaN     NaN      NaN    NaN     NaN   \n",
       "墨西哥       NaN  ...    NaN     NaN    NaN   580.0      NaN    NaN     NaN   \n",
       "巴哈马       NaN  ...    NaN     NaN    NaN     NaN      NaN    NaN     NaN   \n",
       "德国        NaN  ...    NaN     NaN    NaN     NaN      NaN    NaN     NaN   \n",
       "澳大利亚      NaN  ...    NaN     NaN    NaN     NaN      NaN    NaN     NaN   \n",
       "瑞典        NaN  ...    NaN     NaN    NaN     NaN      NaN    NaN     NaN   \n",
       "瑞士        NaN  ...    NaN     NaN    NaN     NaN      NaN    NaN     NaN   \n",
       "美国        NaN  ...  600.0  1200.0  800.0   840.0   1000.0  600.0  8400.0   \n",
       "英国        NaN  ...    NaN     NaN    NaN     NaN      NaN    NaN     NaN   \n",
       "越南        NaN  ...    NaN     NaN    NaN     NaN      NaN    NaN     NaN   \n",
       "韩国        NaN  ...    NaN     NaN    NaN   560.0      NaN    NaN     NaN   \n",
       "马耳他       NaN  ...    NaN     NaN    NaN     NaN      NaN    NaN     NaN   \n",
       "\n",
       "行业       软件服务    金融科技    食品饮料  \n",
       "国家                             \n",
       "中国     1300.0  8000.0  1000.0  \n",
       "以色列       NaN     NaN     NaN  \n",
       "印度        NaN     NaN     NaN  \n",
       "印度尼西亚     NaN     NaN     NaN  \n",
       "土耳其       NaN     NaN     NaN  \n",
       "墨西哥       NaN     NaN     NaN  \n",
       "巴哈马       NaN     NaN     NaN  \n",
       "德国      555.0     NaN     NaN  \n",
       "澳大利亚   1750.0     NaN     NaN  \n",
       "瑞典        NaN     NaN     NaN  \n",
       "瑞士        NaN     NaN     NaN  \n",
       "美国      750.0  4100.0   470.0  \n",
       "英国      570.0  1900.0     NaN  \n",
       "越南        NaN     NaN     NaN  \n",
       "韩国        NaN     NaN     NaN  \n",
       "马耳他       NaN     NaN     NaN  \n",
       "\n",
       "[16 rows x 26 columns]"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun.pivot_table(index='国家',columns='行业',values='价值（亿元人民币）',aggfunc='max')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "121a39eb",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>行业</th>\n",
       "      <th>人工智能</th>\n",
       "      <th>企业服务</th>\n",
       "      <th>保险</th>\n",
       "      <th>健康科技</th>\n",
       "      <th>共享经济</th>\n",
       "      <th>分析</th>\n",
       "      <th>区块链</th>\n",
       "      <th>大数据</th>\n",
       "      <th>快递</th>\n",
       "      <th>教育科技</th>\n",
       "      <th>...</th>\n",
       "      <th>游戏</th>\n",
       "      <th>物流</th>\n",
       "      <th>生物科技</th>\n",
       "      <th>电子商务</th>\n",
       "      <th>社交媒体</th>\n",
       "      <th>网络安全</th>\n",
       "      <th>航天</th>\n",
       "      <th>软件服务</th>\n",
       "      <th>金融科技</th>\n",
       "      <th>食品饮料</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th>城市</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"11\" valign=\"top\">中国</th>\n",
       "      <th>上海</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1040.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>670.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1300.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>北京</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>740.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>965.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>500.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>670.0</td>\n",
       "      <td>13400.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>570.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1000.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>宁波</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>宿迁</th>\n",
       "      <td>NaN</td>\n",
       "      <td>515.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>常州</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>广州</th>\n",
       "      <td>570.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>4000.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>无锡</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>杭州</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>470.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1800.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>8000.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>深圳</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>535.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2200.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>长沙</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>香港</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>870.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <th>内坦亚</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>535.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">印度</th>\n",
       "      <th>古尔冈</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>480.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>孟买</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>535.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>班加罗尔</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>720.0</td>\n",
       "      <td>1500.0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">印度尼西亚</th>\n",
       "      <th>Kebayoran Baru</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>700.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>雅加达</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1300.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>土耳其</th>\n",
       "      <th>伊斯坦布尔</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>800.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>墨西哥</th>\n",
       "      <th>墨西哥城</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>580.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>巴哈马</th>\n",
       "      <th>拿索</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1300.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>德国</th>\n",
       "      <th>慕尼黑</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>555.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>澳大利亚</th>\n",
       "      <th>悉尼</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1750.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">瑞典</th>\n",
       "      <th>哥德堡</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>斯德哥尔摩</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞士</th>\n",
       "      <th>Zug</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>575.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"15\" valign=\"top\">美国</th>\n",
       "      <th>Novi</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>哈里斯堡</th>\n",
       "      <td>500.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣何塞</th>\n",
       "      <td>460.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>555.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣迭戈</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>800.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>帕洛阿尔托</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>490.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>495.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>旧金山</th>\n",
       "      <td>870.0</td>\n",
       "      <td>1170.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>760.0</td>\n",
       "      <td>2500.0</td>\n",
       "      <td>1320.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>600.0</td>\n",
       "      <td>535.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>840.0</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>750.0</td>\n",
       "      <td>4100.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>格兰岱尔市</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>480.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>沃尔瑟姆</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>840.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>波士顿</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>480.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>洛杉矶</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>8400.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>爱莫利维尔</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>600.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>纽约</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>470.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>575.0</td>\n",
       "      <td>710.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>535.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>470.0</td>\n",
       "      <td>540.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>芝加哥</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>540.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1500.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>费城</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>雷德伍德城</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>470.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>英国</th>\n",
       "      <th>伦敦</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>700.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>570.0</td>\n",
       "      <td>1900.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>越南</th>\n",
       "      <th>胡志明市</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>韩国</th>\n",
       "      <th>首尔</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>535.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>560.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>马耳他</th>\n",
       "      <th>马耳他</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3000.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>44 rows × 26 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "行业                     人工智能    企业服务     保险    健康科技    共享经济     分析     区块链  \\\n",
       "国家    城市                                                                    \n",
       "中国    上海                NaN     NaN    NaN  1040.0     NaN    NaN     NaN   \n",
       "      北京                NaN     NaN  740.0     NaN   965.0    NaN     NaN   \n",
       "      宁波                NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "      宿迁                NaN   515.0    NaN     NaN     NaN    NaN     NaN   \n",
       "      常州                NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "      广州              570.0     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "      无锡                NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "      杭州                NaN     NaN    NaN   470.0     NaN    NaN     NaN   \n",
       "      深圳                NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "      长沙                NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "      香港                NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "以色列   内坦亚               NaN     NaN    NaN     NaN     NaN    NaN   535.0   \n",
       "印度    古尔冈               NaN     NaN    NaN     NaN   480.0    NaN     NaN   \n",
       "      孟买                NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "      班加罗尔              NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "印度尼西亚 Kebayoran Baru    NaN     NaN    NaN     NaN   700.0    NaN     NaN   \n",
       "      雅加达               NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "土耳其   伊斯坦布尔             NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "墨西哥   墨西哥城              NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "巴哈马   拿索                NaN     NaN    NaN     NaN     NaN    NaN  1300.0   \n",
       "德国    慕尼黑               NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "澳大利亚  悉尼                NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "瑞典    哥德堡               NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "      斯德哥尔摩             NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "瑞士    Zug               NaN     NaN    NaN     NaN     NaN    NaN   575.0   \n",
       "美国    Novi              NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "      哈里斯堡            500.0     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "      圣何塞             460.0     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "      圣迭戈               NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "      帕洛阿尔托             NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "      旧金山             870.0  1170.0    NaN     NaN     NaN    NaN   760.0   \n",
       "      格兰岱尔市             NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "      沃尔瑟姆              NaN     NaN    NaN   840.0     NaN    NaN     NaN   \n",
       "      波士顿               NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "      洛杉矶               NaN     NaN    NaN     NaN  1000.0    NaN     NaN   \n",
       "      爱莫利维尔             NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "      纽约                NaN     NaN    NaN   470.0     NaN  575.0   710.0   \n",
       "      芝加哥               NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "      费城                NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "      雷德伍德城             NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "英国    伦敦                NaN     NaN    NaN     NaN     NaN    NaN   700.0   \n",
       "越南    胡志明市              NaN     NaN    NaN     NaN     NaN    NaN     NaN   \n",
       "韩国    首尔                NaN     NaN    NaN     NaN     NaN    NaN   535.0   \n",
       "马耳他   马耳他               NaN     NaN    NaN     NaN     NaN    NaN  3000.0   \n",
       "\n",
       "行业                       大数据      快递    教育科技  ...     游戏      物流   生物科技  \\\n",
       "国家    城市                                      ...                         \n",
       "中国    上海                 NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "      北京                 NaN     NaN     NaN  ...    NaN   500.0    NaN   \n",
       "      宁波                 NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "      宿迁                 NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "      常州                 NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "      广州                 NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "      无锡                 NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "      杭州                 NaN     NaN     NaN  ...    NaN  1800.0    NaN   \n",
       "      深圳               535.0     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "      长沙                 NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "      香港                 NaN     NaN     NaN  ...    NaN   870.0    NaN   \n",
       "以色列   内坦亚                NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "印度    古尔冈                NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "      孟买                 NaN     NaN     NaN  ...  535.0     NaN    NaN   \n",
       "      班加罗尔               NaN   720.0  1500.0  ...    NaN     NaN    NaN   \n",
       "印度尼西亚 Kebayoran Baru     NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "      雅加达                NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "土耳其   伊斯坦布尔              NaN   800.0     NaN  ...    NaN     NaN    NaN   \n",
       "墨西哥   墨西哥城               NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "巴哈马   拿索                 NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "德国    慕尼黑                NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "澳大利亚  悉尼                 NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "瑞典    哥德堡                NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "      斯德哥尔摩              NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "瑞士    Zug                NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "美国    Novi               NaN     NaN     NaN  ...    NaN  1200.0    NaN   \n",
       "      哈里斯堡               NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "      圣何塞                NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "      圣迭戈                NaN     NaN     NaN  ...    NaN     NaN  800.0   \n",
       "      帕洛阿尔托              NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "      旧金山             2500.0  1320.0     NaN  ...  600.0   535.0    NaN   \n",
       "      格兰岱尔市              NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "      沃尔瑟姆               NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "      波士顿                NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "      洛杉矶                NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "      爱莫利维尔              NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "      纽约                 NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "      芝加哥                NaN     NaN     NaN  ...    NaN     NaN  540.0   \n",
       "      费城                 NaN  1000.0     NaN  ...    NaN     NaN    NaN   \n",
       "      雷德伍德城              NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "英国    伦敦                 NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "越南    胡志明市               NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "韩国    首尔                 NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "马耳他   马耳他                NaN     NaN     NaN  ...    NaN     NaN    NaN   \n",
       "\n",
       "行业                      电子商务     社交媒体   网络安全      航天    软件服务    金融科技    食品饮料  \n",
       "国家    城市                                                                      \n",
       "中国    上海               670.0      NaN    NaN     NaN  1300.0     NaN     NaN  \n",
       "      北京               670.0  13400.0    NaN     NaN   570.0     NaN  1000.0  \n",
       "      宁波                 NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "      宿迁                 NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "      常州                 NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "      广州              4000.0      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "      无锡                 NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "      杭州                 NaN      NaN    NaN     NaN     NaN  8000.0     NaN  \n",
       "      深圳                 NaN      NaN    NaN     NaN     NaN  2200.0     NaN  \n",
       "      长沙                 NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "      香港                 NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "以色列   内坦亚                NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "印度    古尔冈                NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "      孟买                 NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "      班加罗尔               NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "印度尼西亚 Kebayoran Baru     NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "      雅加达             1300.0      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "土耳其   伊斯坦布尔              NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "墨西哥   墨西哥城             580.0      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "巴哈马   拿索                 NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "德国    慕尼黑                NaN      NaN    NaN     NaN   555.0     NaN     NaN  \n",
       "澳大利亚  悉尼                 NaN      NaN    NaN     NaN  1750.0     NaN     NaN  \n",
       "瑞典    哥德堡                NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "      斯德哥尔摩              NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "瑞士    Zug                NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "美国    Novi               NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "      哈里斯堡               NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "      圣何塞                NaN      NaN  555.0     NaN     NaN     NaN     NaN  \n",
       "      圣迭戈                NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "      帕洛阿尔托            490.0      NaN    NaN     NaN     NaN   495.0     NaN  \n",
       "      旧金山              840.0   1000.0    NaN     NaN   750.0  4100.0     NaN  \n",
       "      格兰岱尔市              NaN      NaN    NaN     NaN   480.0     NaN     NaN  \n",
       "      沃尔瑟姆               NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "      波士顿                NaN      NaN    NaN     NaN   480.0     NaN     NaN  \n",
       "      洛杉矶                NaN      NaN    NaN  8400.0     NaN     NaN     NaN  \n",
       "      爱莫利维尔              NaN      NaN  600.0     NaN     NaN     NaN     NaN  \n",
       "      纽约                 NaN      NaN  535.0     NaN   470.0   540.0     NaN  \n",
       "      芝加哥                NaN      NaN    NaN     NaN     NaN  1500.0     NaN  \n",
       "      费城                 NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "      雷德伍德城              NaN      NaN    NaN     NaN     NaN     NaN   470.0  \n",
       "英国    伦敦                 NaN      NaN    NaN     NaN   570.0  1900.0     NaN  \n",
       "越南    胡志明市               NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "韩国    首尔               560.0      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "马耳他   马耳他                NaN      NaN    NaN     NaN     NaN     NaN     NaN  \n",
       "\n",
       "[44 rows x 26 columns]"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun.pivot_table(index=['国家','城市'],columns='行业',values='价值（亿元人民币）',aggfunc='max')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "86b18151",
   "metadata": {},
   "source": [
    "# 3.pivot 多级索引"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "b51b65b5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Class</th>\n",
       "      <th>Name</th>\n",
       "      <th>Examination</th>\n",
       "      <th>Subject</th>\n",
       "      <th>Grade</th>\n",
       "      <th>rank</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>San Zhang</td>\n",
       "      <td>Mid</td>\n",
       "      <td>Chinese</td>\n",
       "      <td>80</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>San Zhang</td>\n",
       "      <td>Final</td>\n",
       "      <td>Chinese</td>\n",
       "      <td>75</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>Si Li</td>\n",
       "      <td>Mid</td>\n",
       "      <td>Chinese</td>\n",
       "      <td>85</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2</td>\n",
       "      <td>Si Li</td>\n",
       "      <td>Final</td>\n",
       "      <td>Chinese</td>\n",
       "      <td>65</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>San Zhang</td>\n",
       "      <td>Mid</td>\n",
       "      <td>Math</td>\n",
       "      <td>90</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>1</td>\n",
       "      <td>San Zhang</td>\n",
       "      <td>Final</td>\n",
       "      <td>Math</td>\n",
       "      <td>85</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>2</td>\n",
       "      <td>Si Li</td>\n",
       "      <td>Mid</td>\n",
       "      <td>Math</td>\n",
       "      <td>92</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>2</td>\n",
       "      <td>Si Li</td>\n",
       "      <td>Final</td>\n",
       "      <td>Math</td>\n",
       "      <td>88</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Class       Name Examination  Subject  Grade  rank\n",
       "0      1  San Zhang         Mid  Chinese     80    10\n",
       "1      1  San Zhang       Final  Chinese     75    15\n",
       "2      2      Si Li         Mid  Chinese     85    21\n",
       "3      2      Si Li       Final  Chinese     65    15\n",
       "4      1  San Zhang         Mid     Math     90    20\n",
       "5      1  San Zhang       Final     Math     85     7\n",
       "6      2      Si Li         Mid     Math     92     6\n",
       "7      2      Si Li       Final     Math     88     2"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame({'Class':[1, 1, 2, 2, 1, 1, 2, 2],\n",
    "     'Name':['San Zhang', 'San Zhang', 'Si Li', 'Si Li',\n",
    "     'San Zhang', 'San Zhang', 'Si Li', 'Si Li'],\n",
    "     'Examination': ['Mid', 'Final', 'Mid', 'Final',\n",
    "     'Mid', 'Final', 'Mid', 'Final'],\n",
    "     'Subject':['Chinese', 'Chinese', 'Chinese', 'Chinese',\n",
    "     'Math', 'Math', 'Math', 'Math'],\n",
    "     'Grade':[80, 75, 85, 65, 90, 85, 92, 88],\n",
    "    'rank':[10, 15, 21, 15, 20, 7, 6, 2]})\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "32227704",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: pyecharts in e:\\python311\\lib\\site-packages (2.0.3)\n",
      "Requirement already satisfied: jinja2 in e:\\python311\\lib\\site-packages (from pyecharts) (3.1.2)\n",
      "Requirement already satisfied: prettytable in e:\\python311\\lib\\site-packages (from pyecharts) (3.7.0)\n",
      "Requirement already satisfied: simplejson in e:\\python311\\lib\\site-packages (from pyecharts) (3.19.1)\n",
      "Requirement already satisfied: MarkupSafe>=2.0 in e:\\python311\\lib\\site-packages (from jinja2->pyecharts) (2.1.2)\n",
      "Requirement already satisfied: wcwidth in e:\\python311\\lib\\site-packages (from prettytable->pyecharts) (0.2.6)\n"
     ]
    }
   ],
   "source": [
    "!pip install pyecharts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "c0dae122",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['哈士奇', '萨摩耶', '泰迪', '金毛', '牧羊犬', '吉娃娃', '柯基']"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Faker.choose()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "20e7cc08",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[79, 144, 27, 146, 35, 121, 135]"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Faker.values()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "ca04f42e",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'df_hurun_pivot' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[40], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m 行业 \u001b[38;5;241m=\u001b[39m \u001b[43mdf_hurun_pivot\u001b[49m\u001b[38;5;241m.\u001b[39mcolumns\u001b[38;5;241m.\u001b[39mtolist()\n\u001b[0;32m      2\u001b[0m 行业\n",
      "\u001b[1;31mNameError\u001b[0m: name 'df_hurun_pivot' is not defined"
     ]
    }
   ],
   "source": [
    "行业 = df_hurun_pivot.columns.tolist()\n",
    "行业"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "0293772e",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'df_hurun_pivot' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[41], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m 中国 \u001b[38;5;241m=\u001b[39m \u001b[43mdf_hurun_pivot\u001b[49m\u001b[38;5;241m.\u001b[39mquery(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m国家 == \u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m中国\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m'\u001b[39m)\u001b[38;5;241m.\u001b[39mvalues[\u001b[38;5;241m0\u001b[39m]\u001b[38;5;241m.\u001b[39mtolist()\n\u001b[0;32m      2\u001b[0m 中国\n",
      "\u001b[1;31mNameError\u001b[0m: name 'df_hurun_pivot' is not defined"
     ]
    }
   ],
   "source": [
    "中国 = df_hurun_pivot.query('国家 == \"中国\"').values[0].tolist()\n",
    "中国"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "12fbcc56",
   "metadata": {},
   "source": [
    "# Bar可视化展示"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "8be91588",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name '行业' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[19], line 7\u001b[0m\n\u001b[0;32m      2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mpyecharts\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcharts\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Bar\n\u001b[0;32m      3\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mpyecharts\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mfaker\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Faker\n\u001b[0;32m      5\u001b[0m c \u001b[38;5;241m=\u001b[39m (\n\u001b[0;32m      6\u001b[0m     Bar()\n\u001b[1;32m----> 7\u001b[0m     \u001b[38;5;241m.\u001b[39madd_xaxis(\u001b[43m行业\u001b[49m)\n\u001b[0;32m      8\u001b[0m     \u001b[38;5;241m.\u001b[39madd_yaxis(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m中国\u001b[39m\u001b[38;5;124m\"\u001b[39m, 中国, stack\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstack1\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m      9\u001b[0m     \u001b[38;5;241m.\u001b[39madd_yaxis(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m美国\u001b[39m\u001b[38;5;124m\"\u001b[39m, 美国, stack\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstack1\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m     10\u001b[0m     \u001b[38;5;241m.\u001b[39mset_series_opts(label_opts\u001b[38;5;241m=\u001b[39mopts\u001b[38;5;241m.\u001b[39mLabelOpts(is_show\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m))\n\u001b[0;32m     11\u001b[0m     \u001b[38;5;241m.\u001b[39mset_global_opts(\n\u001b[0;32m     12\u001b[0m         datazoom_opts\u001b[38;5;241m=\u001b[39mopts\u001b[38;5;241m.\u001b[39mDataZoomOpts(),\n\u001b[0;32m     13\u001b[0m         title_opts\u001b[38;5;241m=\u001b[39mopts\u001b[38;5;241m.\u001b[39mTitleOpts(title\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mBar-胡润TOP独角兽中美对比\u001b[39m\u001b[38;5;124m\"\u001b[39m))\n\u001b[0;32m     14\u001b[0m     \n\u001b[0;32m     15\u001b[0m )\n\u001b[0;32m     16\u001b[0m c\u001b[38;5;241m.\u001b[39mrender_notebook()\n",
      "\u001b[1;31mNameError\u001b[0m: name '行业' is not defined"
     ]
    }
   ],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Bar\n",
    "from pyecharts.faker import Faker\n",
    "\n",
    "c = (\n",
    "    Bar()\n",
    "    .add_xaxis(行业)\n",
    "    .add_yaxis(\"中国\", 中国, stack=\"stack1\")\n",
    "    .add_yaxis(\"美国\", 美国, stack=\"stack1\")\n",
    "    .set_series_opts(label_opts=opts.LabelOpts(is_show=False))\n",
    "    .set_global_opts(\n",
    "        datazoom_opts=opts.DataZoomOpts(),\n",
    "        title_opts=opts.TitleOpts(title=\"Bar-胡润TOP独角兽中美对比\"))\n",
    "    \n",
    ")\n",
    "c.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "be785573",
   "metadata": {},
   "source": [
    "# Pie饼状图的可视化展示"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5e06018e",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Bar\n",
    "from pyecharts.faker import Faker\n",
    "\n",
    "c = (\n",
    "    Bar()\n",
    "    .add_xaxis(Faker.days_attrs)\n",
    "    .add_yaxis(\"商家A\", Faker.days_values)\n",
    "    .set_global_opts(\n",
    "        title_opts=opts.TitleOpts(title=\"Bar-DataZoom（slider-水平）\"),\n",
    "        datazoom_opts=opts.DataZoomOpts(),\n",
    "    )\n",
    "    .render(\"bar_datazoom_slider.html\")\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "737f4b76",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'df_hurun_pivot' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[48], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43mdf_hurun_pivot\u001b[49m\u001b[38;5;241m.\u001b[39mindex\n",
      "\u001b[1;31mNameError\u001b[0m: name 'df_hurun_pivot' is not defined"
     ]
    }
   ],
   "source": [
    "df_hurun_pivot.index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "69489daa",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'df_hurun_pivot' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[49], line 2\u001b[0m\n\u001b[0;32m      1\u001b[0m 国家数据\u001b[38;5;241m=\u001b[39m[]\n\u001b[1;32m----> 2\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m \u001b[43mdf_hurun_pivot\u001b[49m\u001b[38;5;241m.\u001b[39mindex:\n\u001b[0;32m      3\u001b[0m     国家数据\u001b[38;5;241m.\u001b[39mappend(df_hurun_pivot\u001b[38;5;241m.\u001b[39mquery(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m国家=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{country}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;241m.\u001b[39mformat(country\u001b[38;5;241m=\u001b[39mi))\u001b[38;5;241m.\u001b[39mvalues[\u001b[38;5;241m0\u001b[39m]\u001b[38;5;241m.\u001b[39mtolist())\n\u001b[0;32m      4\u001b[0m 国家数据\n",
      "\u001b[1;31mNameError\u001b[0m: name 'df_hurun_pivot' is not defined"
     ]
    }
   ],
   "source": [
    "国家数据=[]\n",
    "for i in df_hurun_pivot.index:\n",
    "    国家数据.append(df_hurun_pivot.query('国家=\"{country}\"'.format(country=i)).values[0].tolist())\n",
    "国家数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "82be4c73",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name '行业' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[41], line 7\u001b[0m\n\u001b[0;32m      2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mpyecharts\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcharts\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Pie\n\u001b[0;32m      3\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mpyecharts\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mfaker\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Faker\n\u001b[0;32m      5\u001b[0m c \u001b[38;5;241m=\u001b[39m (\n\u001b[0;32m      6\u001b[0m     Pie()\n\u001b[1;32m----> 7\u001b[0m     \u001b[38;5;241m.\u001b[39madd(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m, [\u001b[38;5;28mlist\u001b[39m(z) \u001b[38;5;28;01mfor\u001b[39;00m z \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mzip\u001b[39m(\u001b[43m行业\u001b[49m, 中国)])\n\u001b[0;32m      8\u001b[0m     \u001b[38;5;241m.\u001b[39mset_colors([\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mblue\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mgreen\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124myellow\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mred\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpink\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124morange\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpurple\u001b[39m\u001b[38;5;124m\"\u001b[39m])\n\u001b[0;32m      9\u001b[0m     \u001b[38;5;241m.\u001b[39mset_global_opts(title_opts\u001b[38;5;241m=\u001b[39mopts\u001b[38;5;241m.\u001b[39mTitleOpts(title\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mPie-设置颜色\u001b[39m\u001b[38;5;124m\"\u001b[39m))\n\u001b[0;32m     10\u001b[0m     \u001b[38;5;241m.\u001b[39mset_series_opts(label_opts\u001b[38;5;241m=\u001b[39mopts\u001b[38;5;241m.\u001b[39mLabelOpts(formatter\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{b}\u001b[39;00m\u001b[38;5;124m: \u001b[39m\u001b[38;5;132;01m{c}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m))\n\u001b[0;32m     11\u001b[0m     \u001b[38;5;241m.\u001b[39mrender(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpie_set_color.html\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m     12\u001b[0m )\n",
      "\u001b[1;31mNameError\u001b[0m: name '行业' is not defined"
     ]
    }
   ],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Pie\n",
    "from pyecharts.faker import Faker\n",
    "\n",
    "c = (\n",
    "    Pie()\n",
    "    .add(\"\", [list(z) for z in zip(行业, 中国)])\n",
    "    .set_colors([\"blue\", \"green\", \"yellow\", \"red\", \"pink\", \"orange\", \"purple\"])\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"Pie-设置颜色\"))\n",
    "    .set_series_opts(label_opts=opts.LabelOpts(formatter=\"{b}: {c}\"))\n",
    "    .render(\"pie_set_color.html\")\n",
    ")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "379f43a7",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
